<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/5
 * Time: 16:03
 */

namespace App\Http\Admin\Administration\Models;

use Framework\BaseClass\Http\Model;
use App\Eloquent\Oa\ConferenceRoomRecord as EloquentConferenceRoomRecord;


class ConferenceRoomRecord extends Model
{

    /**
     * 获取会议室记录列表
     * @Author sxy
     * @param $page
     * @param $pageSize
     * @param $searchField
     * @return mixed
     */
    public function getConferenceRoomRecordList($page, $pageSize, $searchField,$id)
    {
        $list = EloquentConferenceRoomRecord::where($searchField)->where('meeting_room_id','=',$id);
        $count = $list->count();
        $list = $list->forPage($page, $pageSize)->get();

        $data['list'] = $list;
        $data['pageCurrent'] = $page;
        $data['totalRow'] = $count;
        return $data;
    }





    /**
     * 获取会议室预约记录详情
     * @Author sxy
     * @param $id
     * @return \Illuminate\Database\Eloquent\Model|null|static
     */
    public function getConferenceRoomInfo($id){
        $result = EloquentConferenceRoomRecord::where('id', '=', $id)->first();
        if (is_null($result)) xThrow(ERR_CONFERENCE_ROOM_RECORD_NOT_EXIST);
        return $result;
    }


}